#include "BHop.h"

BHop g_pBHop;

void BHop::Init()
{
	Active = true;
}

void BHop::Enable()
{
	Active = true;
}

void BHop::Disable()
{
	Active = false;
}

void BHop::SetActive(bool bActive)
{
	Active = bActive;
}

void BHop::Compute(CUserCmd* cmd)
{
	if(!(cmd->buttons & IN_JUMP))
		return;
	Entity* pMe = g_pInterfaces.g_pEntList->GetClientEntity(g_pInterfaces.g_pEngine->GetLocalPlayer());
	if(!pMe || pMe->dormant())
		return;
	if(!(*pMe->fFlags() & FL_ONGROUND))
		cmd->buttons &= ~IN_JUMP;
}